//
//  YKClientNeedsItemCell.m
//  YunKang
//
//  Created by leoking870 on 2017/10/3.
//  Copyright © 2017年 leoking870. All rights reserved.
//

#import "YKClientNeedsItemCell.h"
#import "YKDashView.h"
@interface YKClientNeedsItemCell ()
@property (weak, nonatomic) IBOutlet UILabel *clientNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *drugNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *requestDateLabel;

@end


@implementation YKClientNeedsItemCell

- (void)cellLoadSubViews {
    [super cellLoadSubViews];
    self.clientNameLabel.tf_weight = 1;
    self.drugNameLabel.tf_weight = 1;
    self.requestDateLabel.tf_weight = 1;

    self.clientNameLabel.textAlignment = NSTextAlignmentCenter;
    self.drugNameLabel.textAlignment = NSTextAlignmentCenter;
    self.requestDateLabel.textAlignment = NSTextAlignmentCenter;

    [@[self.clientNameLabel, self.drugNameLabel, self.requestDateLabel] mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.top.equalTo(self.contentView.mas_top).offset(11);
    }];
    
    [@[self.clientNameLabel, self.drugNameLabel, self.requestDateLabel] mas_alignWeightlyAlongAxis:MASAxisTypeHorizontal
                                                                                      fixedSpace:@8
                                                                                       leadingTo:self.contentView.mas_leading
                                                                                       leadSpace:13
                                                                                      trailingTo:self.contentView.mas_trailing
                                                                                       tailSpace:13];
    
    YKDashView* dashView = [[YKDashView alloc]init];
    dashView.lineWidth = .5f;
    dashView.lineColor = [UIColor tf_colorWithHexString:@"#d4d4d4"];
    dashView.dashLineLength = 3;
    [self addSubview:dashView];
    [dashView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.bottom.trailing.equalTo(self);
        make.height.mas_equalTo(1);
    }];
}

- (void)cellWillAppear {
    [super cellWillAppear];
    self.clientNameLabel.text = self.tableViewItem.model.C_NAME;
    self.drugNameLabel.text = self.tableViewItem.model.DRUGSNAME;
    self.requestDateLabel.text = [[self.tableViewItem.model.CREATETIME componentsSeparatedByString:@" "] firstObject];
}

@end
